<?php
/**
 * | @author 韩威兵^life <1877361302@qq.com>
 * +----------------------------------------------------------------------
 * | @copyright 2016 - 2019 HQ
 * +----------------------------------------------------------------------
 * | @version $Id: 2019/4/26 16:54 jiahe_new verifiableServer.php 韩威兵^life $
 * +----------------------------------------------------------------------
 */

namespace app\common\common\Server;

class  verifiableServer
{
    /**
     * 验证手机号是否正确
     * @author honfei
     * @param number $mobile
     */
    public static function isMobile($mobile)
    {
        if (!is_numeric($mobile)) {
            return false;
        }
        return preg_match('#^1[3456789]\d{9}$#', $mobile) ? true : false;
    }

    /**
     * json保存中文信息
     * @param $content
     */
    public static function jsonEncodeChinese($content){
        return json_encode($content, JSON_UNESCAPED_UNICODE);
    }

    /**
     * 是否是周末
     * @param string $time  可以是时间戳，也是可以是时间字符串
     * @return string 返回的是字符串，weekend,working
     */
    public static function isWeekend($time = ''){
        if(empty($time)){
            $time = time();
        }
        if(is_numeric($time)){
            $w = date('w', $time);
        }else{
            $w = date('w', strtotime($time));
        }
        if($w == 6 || $w == 0){
            return 'weekend';
        }else{
            return 'working';
        }
    }

}  